#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include <stdlib.h>


int my_atoi(char* arr)
{
    int num = strlen(arr);
    int i = 1;
    int count = 1;
    while (i < num && arr[i] >= '0' && arr[i] <= '9')
    {
        count = 10 * count;
        i++;
    }
    i = 0;
    int sum = 0;
    while (arr[i])
    {
        switch (arr[i])
        {
        case '0':
            sum = sum + 0;
            count /= 10;
            break;
        case '1':
            sum = sum + 1 * count;
            count /= 10;
            break;
        case '2':
            sum = sum + 2 * count;
            count /= 10;
            break;
        case '3':
            sum = sum + 3 * count;
            count /= 10;
            break;
        case '4':
            sum = sum + 4 * count;
            count /= 10;
            break;
        case '5':
            sum = sum + 5 * count;
            count /= 10;
            break;
        case '6':
            sum = sum + 6 * count;
            count /= 10;
            break;
        case '7':
            sum = sum + 7 * count;
            count /= 10;
            break;
        case '8':
            sum = sum + 8 * count;
            count /= 10;
            break;
        case '9':
            sum = sum + 9 * count;
            count /= 10;
            break;
        default:
            return sum;

        }
        i++;
    }
    return sum;
}

int main()
{
    char tmp[6] = "20:30";
    int sum = my_atoi(tmp);
    printf("sum = %d\n", sum);
    return 0;
}
